<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>全文搜索技术深度解析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .highlight {
            position: relative;
            z-index: 1;
        }
        .highlight:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 30%;
            background-color: rgba(110, 142, 251, 0.2);
            z-index: -1;
            transition: all 0.3s ease;
        }
        .highlight:hover:after {
            height: 100%;
        }
        .custom-list li {
            position: relative;
            padding-left: 1.5rem;
            margin-bottom: 0.5rem;
        }
        .custom-list li:before {
            content: '•';
            position: absolute;
            left: 0;
            color: #6e8efb;
            font-weight: bold;
        }
        .first-letter:first-letter {
            font-size: 3.5rem;
            float: left;
            line-height: 1;
            margin-right: 0.8rem;
            color: #6e8efb;
            font-weight: bold;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">全文搜索技术深度解析</h1>
            <p class="text-xl md:text-2xl mb-8 max-w-3xl mx-auto opacity-90">探索信息爆炸时代的核心技术，构建高效精准的搜索体验</p>
            <div class="flex justify-center space-x-4">
                <a href="#intro" class="px-6 py-3 bg-white text-indigo-600 font-semibold rounded-full hover:bg-gray-100 transition duration-300">
                    <i class="fas fa-search mr-2"></i>开始探索
                </a>
                <a href="#case" class="px-6 py-3 border border-white text-white font-semibold rounded-full hover:bg-white hover:text-indigo-600 transition duration-300">
                    <i class="fas fa-laptop-code mr-2"></i>实战案例
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <div class="container mx-auto max-w-5xl px-4 md:px-0 py-16">
        <!-- Introduction -->
        <section id="intro" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 flex-1"></div>
                <h2 class="text-3xl font-bold px-4 text-gray-800">一、引言</h2>
                <div class="h-1 bg-indigo-500 flex-1"></div>
            </div>
            <div class="bg-white rounded-xl shadow-md p-8 card-hover">
                <p class="first-letter text-lg text-gray-700">
                    在信息爆炸的时代，无论是电商平台的商品检索、社交网络的内容筛选，还是企业内部的文档管理，用户对高效、准确的全文搜索需求愈发明显。传统的关系型数据库虽然支持基于索引的精确查询，但在处理模糊匹配、多条件组合、语义分析等复杂场景时，效率往往不尽人意。全文搜索引擎应运而生，旨在通过先进的索引结构和查询算法，快速定位目标信息，提升搜索性能和用户体验。
                </p>
            </div>
        </section>

        <!-- Core Concepts -->
        <section id="concepts" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 flex-1"></div>
                <h2 class="text-3xl font-bold px-4 text-gray-800">二、全文搜索的核心概念</h2>
                <div class="h-1 bg-indigo-500 flex-1"></div>
            </div>

            <div class="grid md:grid-cols-3 gap-8">
                <!-- Index Structure -->
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-600 mr-4">
                            <i class="fas fa-sitemap text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">2.1 索引结构</h3>
                    </div>
                    <p class="text-gray-700 mb-4">全文搜索的核心在于高效的索引结构。与关系型数据库不同，搜索引擎通过<strong class="highlight">倒排索引（Inverted Index）</strong>实现快速检索：</p>
                    <ul class="custom-list text-gray-700 mb-4">
                        <li><strong>正向索引</strong>：记录每个文档中包含的关键词及其位置信息。</li>
                        <li><strong>倒排索引</strong>：以关键词为键，存储包含该关键词的所有文档列表。</li>
                    </ul>
                    <div class="mt-4 p-4 bg-gray-50 rounded-lg">
                        <h4 class="font-semibold text-gray-700 mb-2">示例：</h4>
                        <div class="font-mono text-sm">
                            <p>“Java” → [文档1, 文档2]</p>
                            <p>“搜索” → [文档1, 文档3]</p>
                            <p>“高性能” → [文档2]</p>
                        </div>
                    </div>
                </div>

                <!-- Tokenization -->
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-600 mr-4">
                            <i class="fas fa-cut text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">2.2 分词与词元</h3>
                    </div>
                    <p class="text-gray-700 mb-4">分词（Tokenization）是将文本拆分为词元（Term）的过程，是全文搜索的基础。常见分词策略包括：</p>
                    <div class="space-y-3">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-5 w-5 text-indigo-500 mt-1">
                                <i class="fas fa-book"></i>
                            </div>
                            <p class="ml-2 text-gray-700"><strong>基于字典的分词</strong>：如IK Analyzer，通过预设词典匹配分词</p>
                        </div>
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-5 w-5 text-indigo-500 mt-1">
                                <i class="fas fa-chart-bar"></i>
                            </div>
                            <p class="ml-2 text-gray-700"><strong>基于统计的分词</strong>：如Jieba，利用大规模语料库训练模型</p>
                        </div>
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-5 w-5 text-indigo-500 mt-1">
                                <i class="fas fa-puzzle-piece"></i>
                            </div>
                            <p class="ml-2 text-gray-700"><strong>N-gram分词</strong>：将文本划分为连续N个字符的子串，适用于短文本检索</p>
                        </div>
                    </div>
                </div>

                <!-- Scoring -->
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-600 mr-4">
                            <i class="fas fa-sort-amount-up-alt text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">2.3 评分机制</h3>
                    </div>
                    <p class="text-gray-700 mb-4">搜索结果的排序基于文档与查询的相关性评分，常用的评分算法包括：</p>
                    <div class="space-y-4">
                        <div>
                            <h4 class="font-semibold text-gray-800 mb-1">TF-IDF（词频-逆文档频率）</h4>
                            <p class="text-gray-700 text-sm">衡量词元在文档中的重要性</p>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-800 mb-1">BM25</h4>
                            <p class="text-gray-700 text-sm">对TF-IDF的改进，动态调整权重，更适合短文本</p>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-800 mb-1">向量相似度</h4>
                            <p class="text-gray-700 text-sm">通过余弦相似度计算文档与查询的语义匹配</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Technology Selection -->
        <section id="tech" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 flex-1"></div>
                <h2 class="text-3xl font-bold px-4 text-gray-800">三、技术选型与框架解析</h2>
                <div class="h-1 bg-indigo-500 flex-1"></div>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <!-- Lucene -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="bg-indigo-600 text-white p-4">
                        <h3 class="text-xl font-bold flex items-center">
                            <i class="fas fa-database mr-2"></i> 3.1 Lucene：全文搜索的奠基石
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">Lucene是Apache开源项目，提供了高性能的全文搜索能力，其核心模块包括：</p>
                        <ul class="custom-list text-gray-700 mb-6">
                            <li><strong>索引创建</strong>：通过<code>IndexWriter</code>构建倒排索引</li>
                            <li><strong>查询解析</strong>：使用<code>QueryParser</code>解析用户输入</li>
                            <li><strong>检索引擎</strong>：通过<code>IndexSearcher</code>执行查询</li>
                        </ul>

                        <div class="mb-6">
                            <h4 class="font-semibold text-gray-800 mb-3 flex items-center">
                                <i class="fas fa-cogs text-indigo-500 mr-2"></i> 3.1.1 索引构建流程
                            </h4>
                            <ol class="list-decimal pl-5 space-y-2 text-gray-700">
                                <li><strong>初始化索引目录</strong>：创建存储目录（如FSDirectory）</li>
                                <li><strong>分词与索引</strong>：对文档内容分词，输出<code>IndexableField</code></li>
                                <li><strong>优化与合并</strong>：调用<code>IndexWriter.forceMerge()</code>减少段数</li>
                            </ol>
                        </div>

                        <div>
                            <h4 class="font-semibold text-gray-800 mb-3 flex items-center">
                                <i class="fas fa-search text-indigo-500 mr-2"></i> 3.1.2 查询执行流程
                            </h4>
                            <ol class="list-decimal pl-5 space-y-2 text-gray-700">
                                <li><strong>解析查询语句</strong>：调用<code>QueryParser.parse()</code></li>
                                <li><strong>执行搜索</strong>：通过<code>IndexSearcher.search()</code>匹配倒排索引</li>
                                <li><strong>返回结果</strong>：将排序后的<code>TopDocs</code>集合返回</li>
                            </ol>
                        </div>
                    </div>
                </div>

                <!-- Elasticsearch -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="bg-indigo-600 text-white p-4">
                        <h3 class="text-xl font-bold flex items-center">
                            <i class="fas fa-server mr-2"></i> 3.2 Elasticsearch：分布式搜索的领军者
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">Elasticsearch是基于Lucene构建的分布式全文搜索引擎，提供了高可用、实时搜索的能力。其核心特性包括：</p>
                        <ul class="custom-list text-gray-700 mb-6">
                            <li><strong>分片机制</strong>：支持水平扩展</li>
                            <li><strong>RESTful API</strong>：JSON格式的API实现搜索功能</li>
                            <li><strong>实时性</strong>：毫秒级数据可见性</li>
                        </ul>

                        <div class="mb-6">
                            <h4 class="font-semibold text-gray-800 mb-3 flex items-center">
                                <i class="fas fa-network-wired text-indigo-500 mr-2"></i> 3.2.1 分布式架构
                            </h4>
                            <div class="grid grid-cols-3 gap-4 text-center mb-4">
                                <div class="bg-indigo-50 p-3 rounded-lg">
                                    <i class="fas fa-cube text-indigo-600 text-2xl mb-2"></i>
                                    <p class="text-sm font-semibold">节点（Node）</p>
                                </div>
                                <div class="bg-indigo-50 p-3 rounded-lg">
                                    <i class="fas fa-star text-indigo-600 text-2xl mb-2"></i>
                                    <p class="text-sm font-semibold">主节点（Master Node）</p>
                                </div>
                                <div class="bg-indigo-50 p-3 rounded-lg">
                                    <i class="fas fa-project-diagram text-indigo-600 text-2xl mb-2"></i>
                                    <p class="text-sm font-semibold">协调节点（Coordinating Node）</p>
                                </div>
                            </div>
                        </div>

                        <div>
                            <h4 class="font-semibold text-gray-800 mb-3 flex items-center">
                                <i class="fas fa-search-plus text-indigo-500 mr-2"></i> 3.2.2 查询执行与聚合
                            </h4>
                            <ol class="list-decimal pl-5 space-y-2 text-gray-700">
                                <li><strong>查询阶段</strong>：请求分发到所有分片</li>
                                <li><strong>取回阶段</strong>：协调节点提取数据</li>
                                <li><strong>聚合查询</strong>：通过Pipeline API实现</li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Mermaid Diagram -->
            <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                <h3 class="text-xl font-bold text-gray-800 mb-4 flex items-center">
                    <i class="fas fa-diagram-project text-indigo-500 mr-2"></i> 全文搜索技术架构关系图
                </h3>
                <div class="mermaid">
                    graph TD
                    A[用户查询] --> B(Elasticsearch集群)
                    B --> C[协调节点]
                    C --> D[数据节点1]
                    C --> E[数据节点2]
                    C --> F[数据节点3]
                    D --> G[Lucene索引]
                    E --> G[Lucene索引]
                    F --> G[Lucene索引]
                    G --> H[倒排索引]
                    H --> I[分词器]
                    H --> J[评分机制]
                </div>
            </div>
        </section>

        <!-- Optimization Strategies -->
        <section id="optimization" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 flex-1"></div>
                <h2 class="text-3xl font-bold px-4 text-gray-800">四、实现高效全文搜索的核心策略</h2>
                <div class="h-1 bg-indigo-500 flex-1"></div>
            </div>

            <div class="grid md:grid-cols-3 gap-8 mb-8">
                <!-- Index Optimization -->
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-600 mr-4">
                            <i class="fas fa-tachometer-alt text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">4.1 索引优化</h3>
                    </div>
                    <div class="space-y-4">
                        <div>
                            <h4 class="font-semibold text-gray-700 mb-2">分词器选型</h4>
                            <div class="flex flex-wrap gap-2">
                                <span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded">StandardTokenizer</span>
                                <span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded">IK Analyzer</span>
                                <span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded">Jieba分词器</span>
                            </div>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-700 mb-2">字段映射</h4>
                            <div class="flex flex-wrap gap-2">
                                <span class="bg-indigo-100 text-indigo-800 text-xs px-2 py-1 rounded">text</span>
                                <span class="bg-indigo-100 text-indigo-800 text-xs px-2 py-1 rounded">keyword</span>
                                <span class="bg-indigo-100 text-indigo-800 text-xs px-2 py-1 rounded">date</span>
                            </div>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-700 mb-2">索引结构优化</h4>
                            <ul class="text-sm text-gray-700 space-y-1">
                                <li>增大<code>refresh_interval</code></li>
                                <li>优化<code>merge.policy</code></li>
                            </ul>
                        </div>
                    </div>
                </div>

                <!-- Query Optimization -->
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-600 mr-4">
                            <i class="fas fa-bolt text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">4.2 查询优化</h3>
                    </div>
                    <div class="space-y-4">
                        <div>
                            <h4 class="font-semibold text-gray-700 mb-2">查询重写</h4>
                            <div class="bg-gray-50 p-3 rounded-lg">
                                <p class="text-sm font-mono text-gray-800">
                                    (A OR B) AND C ⇒ (A AND C) OR (B AND C)
                                </p>
                            </div>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-700 mb-2">缓存机制</h4>
                            <ul class="text-sm text-gray-700 space-y-1">
                                <li>查询缓存</li>
                                <li>分片请求缓存</li>
                            </ul>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-700 mb-2">分页优化</h4>
                            <div class="flex flex-wrap gap-2">
                                <span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded">search_after</span>
                                <span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded">scroll API</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Scaling & HA -->
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-600 mr-4">
                            <i class="fas fa-expand-arrows-alt text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">4.3 扩展与高可用</h3>
                    </div>
                    <div class="space-y-4">
                        <div>
                            <h4 class="font-semibold text-gray-700 mb-2">分片与副本</h4>
                            <p class="text-sm text-gray-700">合理配置主分片数和副本数</p>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-700 mb-2">集群监控</h4>
                            <ul class="text-sm text-gray-700 space-y-1">
                                <li>Kibana监控</li>
                                <li>告警机制</li>
                            </ul>
                        </div>
                        <div>
                            <h4 class="font-semibold text-gray-700 mb-2">无缝扩展</h4>
                            <ul class="text-sm text-gray-700 space-y-1">
                                <li>冷热数据分离</li>
                                <li>索引生命周期管理（ILM）</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Index vs Query Optimization -->
            <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                <h3 class="text-xl font-bold text-gray-800 mb-4 flex items-center">
                    <i class="fas fa-balance-scale text-indigo-500 mr-2"></i> 索引优化与查询优化的平衡
                </h3>
                <div class="mermaid">
                    pie
                    title 优化策略分布
                    "索引优化" : 45
                    "查询优化" : 35
                    "扩展与高可用" : 20
                </div>
            </div>
        </section>

        <!-- Case Study -->
        <section id="case" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 flex-1"></div>
                <h2 class="text-3xl font-bold px-4 text-gray-800">五、实战案例：电商平台的商品搜索优化</h2>
                <div class="h-1 bg-indigo-500 flex-1"></div>
            </div>

            <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                <div class="bg-indigo-600 text-white p-4">
                    <h3 class="text-xl font-bold">5.1 项目背景</h3>
                </div>
                <div class="p-6">
                    <p class="text-gray-700 mb-4">
                        某电商平台每日新增商品超过10万条，用户日均搜索量超过500万次，要求实现以下目标：
                    </p>
                    <ul class="custom-list text-gray-700 mb-4">
                        <li>实时索引与检索</li>
                        <li>支持多条件组合查询（如价格范围、品牌筛选）</li>
                        <li>提供个性化推荐</li>
                    </ul>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mt-8">
                <!-- Index Design -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="bg-indigo-600 text-white p-4">
                        <h3 class="text-xl font-bold">5.2.1 索引设计</h3>
                    </div>
                    <div class="p-6">
                        <ul class="custom-list text-gray-700 space-y-3">
                            <li>
                                <strong>商品索引</strong>：包含标题、描述、价格、品牌等字段
                            </li>
                            <li>
                                <strong>类别索引</strong>：存储商品与类别的映射关系
                            </li>
                            <li>
                                <strong>用户索引</strong>：记录用户行为日志，支持个性化搜索
                            </li>
                        </ul>
                    </div>
                </div>

                <!-- Query Implementation -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="bg-indigo-600 text-white p-4">
                        <h3 class="text-xl font-bold">5.2.2 查询实现</h3>
                    </div>
                    <div class="p-6">
                        <div class="mb-4">
                            <h4 class="font-semibold text-gray-800 mb-2">多条件查询</h4>
                            <div class="bg-gray-800 rounded-lg p-4 overflow-x-auto">
                                <pre class="text-green-400 text-sm"><code>{
  "query": {
    "bool": {
      "must": [
        { "match": { "title": "手机" } },
        { "range": { "price": { "gte": 2000, "lte": 5000 } } }
      ]
    }
  }
}</code></pre>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Performance Optimization -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mt-8 card-hover">
                <div class="bg-indigo-600 text-white p-4">
                    <h3 class="text-xl font-bold">5.2.3 性能优化</h3>
                </div>
                <div class="p-6">
                    <div class="grid md:grid-cols-3 gap-4">
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <div class="text-indigo-600 mb-2">
                                <i class="fas fa-copy"></i>
                            </div>
                            <h4 class="font-semibold text-gray-800 mb-1">分页优化</h4>
                            <p class="text-sm text-gray-700">使用<code>search_after</code>实现分页</p>
                        </div>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <div class="text-indigo-600 mb-2">
                                <i class="fas fa-recycle"></i>
                            </div>
                            <h4 class="font-semibold text-gray-800 mb-1">索引管理</h4>
                            <p class="text-sm text-gray-700">ILM自动滚动旧索引</p>
                        </div>
                        <div class="bg-indigo-50 p-4 rounded-lg">
                            <div class="text-indigo-600 mb-2">
                                <i class="fas fa-clone"></i>
                            </div>
                            <h4 class="font-semibold text-gray-800 mb-1">分片副本</h4>
                            <p class="text-sm text-gray-700">提升写入性能</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Future Trends -->
        <section id="future" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 flex-1"></div>
                <h2 class="text-3xl font-bold px-4 text-gray-800">六、全文搜索的未来发展与挑战</h2>
                <div class="h-1 bg-indigo-500 flex-1"></div>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <!-- Emerging Tech -->
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-600 mr-4">
                            <i class="fas fa-lightbulb text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">6.1 新兴技术</h3>
                    </div>
                    <div class="space-y-4">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-5 w-5 text-indigo-500 mt-1">
                                <i class="fas fa-brain"></i>
                            </div>
                            <p class="ml-2 text-gray-700"><strong>语义搜索</strong>：通过BERT等预训练模型，提升搜索的上下文理解能力</p>
                        </div>
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-5 w-5 text-indigo-500 mt-1">
                                <i class="fas fa-project-diagram"></i>
                            </div>
                            <p class="ml-2 text-gray-700"><strong>知识图谱</strong>：结合实体关系，增强搜索的语义表达能力</p>
                        </div>
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-5 w-5 text-indigo-500 mt-1">
                                <i class="fas fa-network-wired"></i>
                            </div>
                            <p class="ml-2 text-gray-700"><strong>边缘计算</strong>：通过分布式边缘节点，实现低延迟的全文搜索</p>
                        </div>
                    </div>
                </div>

                <!-- Challenges -->
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center text-indigo-600 mr-4">
                            <i class="fas fa-exclamation-triangle text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">6.2 持续挑战</h3>
                    </div>
                    <div class="space-y-4">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-5 w-5 text-indigo-500 mt-1">
                                <i class="fas fa-images"></i>
                            </div>
                            <p class="ml-2 text-gray-700"><strong>多模态数据</strong>：支持文本、图像、视频的多模态搜索</p>
                        </div>
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-5 w-5 text-indigo-500 mt-1">
                                <i class="fas fa-stopwatch"></i>
                            </div>
                            <p class="ml-2 text-gray-700"><strong>实时性要求</strong>：在毫秒级内处理海量数据的实时索引与查询</p>
                        </div>
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-5 w-5 text-indigo-500 mt-1">
                                <i class="fas fa-user-shield"></i>
                            </div>
                            <p class="ml-2 text-gray-700"><strong>隐私保护</strong>：在搜索过程中平衡用户体验与用户隐私</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8">
        <div class="container mx-auto max-w-5xl px-4 md:px-0">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <a href="http://www.yuque.com/jtostring" class="text-indigo-400 hover:text-indigo-300 transition duration-300">
                        http://www.yuque.com/jtostring
                    </a>
                </div>
                <div class="flex space-x-4">
                    <a href="#" class="w-10 h-10 bg-gray-800 rounded-full flex items-center justify-center hover:bg-indigo-600 transition duration-300">
                        <i class="fab fa-github"></i>
                    </a>
                    <a href="#" class="w-10 h-10 bg-gray-800 rounded-full flex items-center justify-center hover:bg-indigo-600 transition duration-300">
                        <i class="fab fa-twitter"></i>
                    </a>
                    <a href="#" class="w-10 h-10 bg-gray-800 rounded-full flex items-center justify-center hover:bg-indigo-600 transition duration-300">
                        <i class="fab fa-linkedin-in"></i>
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>